from django.contrib import admin
from .models import Food, FoodCategory, ScanRecord

@admin.register(Food)
class FoodAdmin(admin.ModelAdmin):
    list_display = ('name', 'production_date', 'shelf_life', 'expiration_date', 'user')
    list_filter = ('expiration_date', 'user')
    search_fields = ('name', 'user__username')

@admin.register(FoodCategory)
class FoodCategoryAdmin(admin.ModelAdmin):
    list_display = ('name', 'description')
    search_fields = ('name',)

@admin.register(ScanRecord)
class ScanRecordAdmin(admin.ModelAdmin):
    list_display = ('food', 'scan_time', 'device_info')
    list_filter = ('scan_time',)
    search_fields = ('food__name',)